import { combineActions, createActions, handleActions } from 'redux-actions'


export const actionTypes = {
    increase: Symbol('increase'),
    decrease: Symbol('decrease'),
    asyncIncrease: Symbol('asyncIncrease'), // 异步增加
    asyncDecrease: Symbol('asyncDecrease'),
    autoIncrease: Symbol('auto-increase'), // 自动增加
    stopAutoIncrease: Symbol('stop-auto-increase'), // 停止自动增加
    add: Symbol('add'),
}

const actions = createActions({
    INCREASE: null,
    DECEEASE: null,
    ASYNC_INCREASEL: null,
    ASYNC_DECREASE: null,
    ADD: number => number
})

export const { increase, decrease, asyncDecrease, asyncIncrease, add } = actions

// export default handleActions({
//     increase: state => state + 1,
//     decrease: state => state - 1,
//     add: (state, { payload }) => state + payload,
// }, 10)

export default handleActions(
    {
        [combineActions(increase, decrease, add)]: (state, { payload }) => state + payload,
    },
    10
);